//
//  ShopAuthenticationManager.m
//  YIChuSeller
//
//  Created by 田小椿 on 2018/12/25.
//  Copyright © 2018年 xiangshengjun. All rights reserved.
//

#import "ShopAuthenticationManager.h"

@implementation ShopAuthenticationManager
+ (void)selectShopAllMessageWithStoreID:(NSString *)storeId success:(CompleteHandle)success fail:(CompleteHandle)fail
{
    [SVProgressHUD showWithStatus:@"加载中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_SELECT_STORE_ALL",
                @"parameters":@{
                        @"storeId":storeId
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD dismiss];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}
+ (void)changeShopIntroduceMessageWithStoreID:(NSString *)storeId introduce:(NSString *)introduceStr success:(CompleteHandle)success fail:(CompleteHandle)fail
{
    [SVProgressHUD showWithStatus:@"修改中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_UPDATE_STORE_INTR",
                @"parameters":@{
                        @"storeId":storeId,
                        @"introduce":introduceStr
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"修改成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)changeShopBussniessTimeWithStoreID:(NSString *)storeId businesstime:(NSString *)businesstimeStr businesSige:(NSString *)businesSigeStr success:(CompleteHandle)success fail:(CompleteHandle)fail
{
    [SVProgressHUD showWithStatus:@"修改中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_UPDATE_STORE_BUSINES",
                @"parameters":@{
                        @"storeId":storeId,
                        @"businesstime":businesstimeStr,
                        @"businesSige":businesSigeStr
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"修改成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)changeShopServiceWithStoreID:(NSString *)storeId serviceSige:(NSString *)serviceSigeStr success:(CompleteHandle)success fail:(CompleteHandle)fail
{
    [SVProgressHUD showWithStatus:@"修改中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_UPDATE_STORE_SERVICESIGE",
                @"parameters":@{
                        @"storeId":storeId,
                        @"serviceSige":serviceSigeStr
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"修改成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)addShopRealPictureWithStoreID:(NSString *)storeId storeImage:(NSString *)storeImageStr success:(CompleteHandle)success fail:(CompleteHandle)fail{
    [SVProgressHUD showWithStatus:@"保存中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_UPDATE_STORE_STOREIMAGE",
                @"parameters":@{
                        @"storeId":storeId,
                        @"storeImage":storeImageStr
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"保存成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)changeShopBackImageWithStoreID:(NSString *)storeId backImage:(NSString *)backImageStr success:(CompleteHandle)success fail:(CompleteHandle)fail{
    [SVProgressHUD showWithStatus:@"修改中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_UPDATE_STORE_BACKIMAGE",
                @"parameters":@{
                        @"storeId":storeId,
                        @"backImage":backImageStr
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"修改成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)changeShopCoverWithStoreID:(NSString *)storeId cover:(NSString *)coverStr success:(CompleteHandle)success fail:(CompleteHandle)fail{
    [SVProgressHUD showWithStatus:@"修改中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_UPDATE_STORE_COVER",
                @"parameters":@{
                        @"storeId":storeId,
                        @"cover":coverStr
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"修改成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)changeShopBaseMessageWithStoreID:(NSString *)storeId name:(NSString *)nameStr logo:(NSString *)logoStr address:(NSString *)addressStr phone:(NSString *)phoneStr longitude:(NSString *)longitudeStr latiitude:(NSString *)latiitudeStr success:(CompleteHandle)success fail:(CompleteHandle)fail
{
    [SVProgressHUD showWithStatus:@"修改中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_UPDATE_STORE_ES",
                @"parameters":@{
                        @"storeId":storeId,
                        @"name":nameStr,
                        @"logo":logoStr,
                        @"address":addressStr,
                        @"phone":phoneStr,
                        @"longitude":longitudeStr,
                        @"latiitude":latiitudeStr
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"修改成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)selectShopBussniessTimeWithStoreID:(NSString *)storeId success:(CompleteHandle)success fail:(CompleteHandle)fail
{
    
    [SVProgressHUD show];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_SELECT_STORE_BUSINES",
                @"parameters":@{
                        @"storeId":storeId
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD dismiss];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)selectShopServiceWithStoreID:(NSString *)storeId success:(CompleteHandle)success fail:(CompleteHandle)fail{
    [SVProgressHUD show];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_SELECT_STORE_SERVICESIGE",
                @"parameters":@{
                        @"storeId":storeId
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD dismiss];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}
+ (void)selectShopRealPictureWithStoreID:(NSString *)storeId success:(CompleteHandle)success fail:(CompleteHandle)fail{
    [SVProgressHUD show];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_SELECT_STORE_STOREIMAGE",
                @"parameters":@{
                        @"storeId":storeId
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD dismiss];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)selectShopBackImageWithStoreID:(NSString *)storeId success:(CompleteHandle)success fail:(CompleteHandle)fail{
    [SVProgressHUD show];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_SELECT_STORE_BACKIMAGE",
                @"parameters":@{
                        @"storeId":storeId
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD dismiss];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)selectShopBaseMessageWithStoreID:(NSString *)storeId success:(CompleteHandle)success fail:(CompleteHandle)fail{
    [SVProgressHUD show];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_SELECT_STORE_ES",
                @"parameters":@{
                        @"storeId":storeId
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD dismiss];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
}

+ (void)commitShopCheckWithStoreID:(NSString *)storeId success:(CompleteHandle)success fail:(CompleteHandle)fail{
    [SVProgressHUD showWithStatus:@"提交中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_UPDATE_STORE_AUDITSTATE",
                @"parameters":@{
                        @"storeId":storeId
                        }
                };
    [HttpHelper Post:@"ycs/Store/Store.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"提交成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
    
    
}




+ (void)userAuthenWithUserId:(NSString *)userId name:(NSString *)nameStr identityNum:(NSString *)identityNumStr image:(NSString *)imageStr fimage:(NSString *)fimageStr userSige:(NSString *)userSigeStr identityImage:(NSString *)identityImageStr license:(NSString *)licenseStr flicense:(NSString *)flicenseStr success:(CompleteHandle)success fail:(CompleteHandle)fail
{
    [SVProgressHUD showWithStatus:@"提交中" maskType:SVProgressHUDMaskTypeClear];
    NSDictionary * jsonStr = [NSDictionary dictionary];
    jsonStr = @{@"api":@"YCS_USERATTESTATION_INSERTUSERATTESTATION",
                @"parameters":@{
                        @"userId":userId,
                        @"name":nameStr,
                        @"identityNum":identityNumStr,
                        @"image":imageStr,
                        @"fimage":fimageStr,
                        @"userSige":userSigeStr,
                        @"identityImage":identityImageStr,
                        @"license":licenseStr,
                        @"flicense":flicenseStr
                        }
                };
    [HttpHelper Post:@"ycs/Userattestation/Userattestation.do" parameters:jsonStr success:^(id responseObject) {
        if ([responseObject[@"cod"] isEqualToString:@"001"]) {
            [SVProgressHUD showSuccessWithStatus:@"提交成功"];
            success(responseObject);
        }else{
            [SVProgressHUD showErrorWithStatus:responseObject[@"describa"]];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"请求数据失败"];
    }];
    
}





@end
